﻿using System.ComponentModel;
using System.Configuration.Install;
using System.ServiceProcess;


namespace SimpleServiceBus.EndpointMonitorService
{
    [RunInstaller(true)]
    public partial class EndpointMonitorServiceInstaller : Installer
    {
        public EndpointMonitorServiceInstaller()
        {
            InitializeComponent();
            SetupServiceInstaller();
        }

        private void SetupServiceInstaller()
        {
            var serviceProcessInstaller = new ServiceProcessInstaller
            {
                Account = ServiceAccount.LocalSystem,
                Password = null,
                Username = null
            };

            // Run as local system
            var serviceInstaller = new ServiceInstaller
            {
                ServiceName = "SSB Endpoint Monitor Service",
                Description = "SSB Endpoint Monitor Service",
                StartType = ServiceStartMode.Automatic
            };

            Installers.AddRange(new Installer[] { serviceProcessInstaller, serviceInstaller });
        }
    }
}
